package priv.pront.code.robot.roboCom_na_2021;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
import java.util.HashSet;
import java.util.Set;

/**
 * @Description:
 * @Author: pront
 * @Time:2023-08-15 13:57
 */
public class 皆大欢喜 {

    static StreamTokenizer str = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    static int n, m;

    static String res = "999999999999999999";
    static boolean[] st;

    static Set<Integer> set = new HashSet<>();
    static int[][] g;

    public static void main(String[] args) throws IOException {
        str.nextToken();
        n = (int) str.nval;
        str.nextToken();
        m = (int) str.nval;
        st = new boolean[n];
        g = new int[m][n];
        for (int i = 0; i < m; i++) {
            for (int j = 0; j < n; j++) {
                str.nextToken();
                g[i][j] = (int) str.nval;
            }
        }
        dfs(0, "");
        String[] result = res.split("");
        for (int i = 0; i < n; i++) {
            System.out.print(Integer.parseInt(result[i]) + 1);
            if (i != n - 1) {
                System.out.print(" ");
            }
        }
    }

    private static void dfs(int cnt, String an) {
        if (cnt == m + 1) return;
        if (check()) {
            if (cnt < res.length() || (cnt == res.length() && Integer.parseInt(an) < Integer.parseInt(res))) res = an;
            return;
        }
        for (int j = 0; j < m; j++) {
            if(set.contains(j)){continue;}
            boolean[] pre = new boolean[n];
            for (int i = 0; i < n; i++) pre[i] = st[i];
            for (int i = 0; i < n; i++) {
                if (g[j][i] == 1) st[i] = true;
                if (g[j][i] == -1) st[i] = false;
            }
            set.add(j);
            dfs(cnt + 1, an + j);
            st = pre;
            set.remove(j);
        }

    }

    private static boolean check() {
        for (boolean cur : st) {
            if(!cur) return false;
        }
        return true;
    }
}
